package models

type OaPrivilege struct {
	Id    int    `xorm:"not null pk autoincr comment('自增主键') INT(11)"`
	Pid   int    `xorm:"comment('栏目ID') INT(3)"`
	Name  string `xorm:"not null comment('权限名') unique VARCHAR(32)"`
	Cate  int    `xorm:"not null comment('') index INT(11)" json:"cate"`
	Index string `xorm:"not null comment('') index INT(11)" json:"index"`
	Icon  string `xorm:"not null comment('') VARCHAR(255)" json:"icon"`
}

func (c *OaPrivilege) GetById() (list []*OaPrivilege, err error) {
	err = engine.Table("oa_privilege").
		Find(&list)
	return
}

func (c *OaPrivilege) GetOneById(id string) (list OaPrivilege, err error) {
	_, err = engine.Table("oa_privilege").
		Where("id = ?", id).
		Get(&list)
	return
}
